#include <iostream>
#include <bitset>
#include <stdexcept>
#include <fstream>
#include <vector>

class Judge
{
	private:
		const int width;
		const int height;
		const int size;
		const int maskPriseSize;
		const int maskWinSize;
		const int maskDouble3Size;
		bool double3;
		bool latePrise;
		bool winner;
		bool isWinner;
		int scorePlayer1;
		int scorePlayer2;
		int	player;
		
		/** NEW MODIF */

		std::bitset<32>   ****map2;
		
		bool              play2(int player, int x, int y);
		bool              tryPlay2J1(int x, int y, std::bitset<32>   ****map2);
		bool              tryPlay2J2(int x, int y, std::bitset<32>   ****map2);

		/** END */
		std::bitset<1444> *map;
		std::bitset<1444> *maskPriseJ1;
		std::bitset<1444> *maskPriseJ2;
		std::bitset<1444> *maskDouble3J1;
		std::bitset<1444> *maskDouble3J2;
		std::bitset<1444> *maskWinJ1;
		std::bitset<1444> *maskWinJ2;
		std::bitset<1444> *mask;
		int *maskPriseOffset;
		int *maskWinOffset;
		int *maskDouble3Offset;
		bool tryPlayJ1(int pos, std::bitset<1444> *map);
		bool tryPlayJ2(int pos, std::bitset<1444> *map);
		bool setMap(int x, int y);
		void affBitset(std::string aff);
		void initMask();
		void initMask2();
	public:
		Judge(std::bitset<32> ****map2/*std::bitset<1444> *map*/, bool double3, bool latePrise);
		int* getScores();
		bool iaPlay(int player, int x, int y, std::bitset<1444> *map);
		int	 getWinner();
		void resetMap();
		void resetGame();
		void affMap();
		void              affMap2();
		bool play(int player, int x, int y);
		int	 playerTurn();
};